package com.iplant.mes.service.po.sfc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;

import java.util.Calendar;

/**
 * 工件履历
 *
 * @author YouWang·Peng
 * 2023-9-14 09:41:04
 */
@DBBasePO(TableName = "sfc_workpiece_resume", Name = false, Active = false, Schemas = DBSchemas.MES,
        CheckName = {"Code", "WorkpieceRecordID,StationID,RoutePartPointID"}, CodeAuto = true, CodePrefix = "SWR" +
        "-{yyyyMMdd}-", CodeNum = 4)
public class SFCWorkpieceResume extends BasePO {

    /**
     * 工件记录ID
     */
    @DBCondition
    @DBField
    public int WorkpieceRecordID = 0;

    /**
     * 工件号
     */
    @DBCondition
    @DBJoin(name = "Code", tableName = "sfc_workpiece_record", tableAsName = "sfc_workpiece_record1", Schemas =
            DBSchemas.MES,
            MainTableField = "WorkpieceRecordID")
    public String WorkpieceCode = "";

    /**
     * 工位
     */
    @DBCondition
    @DBField
    public int StationID = 0;

    /**
     * 工位名称
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "fmc_station1", Schemas = DBSchemas.Basic,
            MainTableField = "StationID")
    public String StationName = "";

    /**
     * 工位编码
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fmc_station", tableAsName = "fmc_station1", Schemas = DBSchemas.Basic,
            MainTableField = "StationID")
    public String StationCode = "";

    /**
     * 工序ID
     */
    @DBCondition
    @DBField
    public int RoutePartPointID = 0;
    /**
     * 工序名称
     */
    @DBJoin(name = "Name", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public String RoutePartPointName = "";
    /**
     * 工序编码
     */
    @DBJoin(name = "Code", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public String RoutePartPointCode = "";

    /**
     * 是否强制做专检
     */
    @DBCondition
    @DBJoin(name = "IsSpecialCheck", tableName = "fpc_routepartpoint", tableAsName = "fpc_routepartpoint1", Schemas =
            DBSchemas.PDM,
            MainTableField = "RoutePartPointID")
    public int IsSpecialCheck = 0;

    /**
     * 上线时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "OnLineTimeS", ParamName2 = "OnLineTimeE")
    @DBField
    public Calendar OnLineTime = Calendar.getInstance();
    /**
     * 上线人ID
     */
    @DBField
    public int OnLinerID = 0;
    /**
     * 上线人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user0", Schemas = DBSchemas.Basic,
            MainTableField = "OnLinerID")
    public String OnLinerName = "";

    /**
     * 自检人ID
     */
    @DBField
    public int SelfCheckID = 0;
    /**
     * 自检人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user1", Schemas = DBSchemas.Basic,
            MainTableField = "SelfCheckID")
    public String SelfCheckName = "";
    /**
     * 自检时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "SelfCheckTimeS", ParamName2 =
            "SelfCheckTimeE")
    @DBField
    public Calendar SelfCheckTime = Calendar.getInstance();

    /**
     * 报工人ID
     */
    @DBField
    public int ReporterID = 0;
    /**
     * 报工人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user2", Schemas = DBSchemas.Basic,
            MainTableField = "ReporterID")
    public String ReporterName = "";
    /**
     * 报工时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "ReporterTimeS", ParamName2 =
            "ReporterTimeE")
    @DBField
    public Calendar ReporterTime = Calendar.getInstance();

    /**
     * 专检人ID
     */
    @DBField
    public int SpecialCheckID = 0;
    /**
     * 专检人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user3", Schemas = DBSchemas.Basic,
            MainTableField = "SpecialCheckID")
    public String SpecialCheckName = "";
    /**
     * 专检时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "SpecialCheckTimeS", ParamName2 =
            "SpecialCheckTimeE")
    @DBField
    public Calendar SpecialCheckTime = Calendar.getInstance();

    /**
     * 互检人ID
     */
    @DBField
    public int MutualCheckID = 0;
    /**
     * 互检人名称
     */
    @DBJoin(name = "Name", tableName = "mbs_user", tableAsName = "mbs_user4", Schemas = DBSchemas.Basic,
            MainTableField = "MutualCheckID")
    public String MutualCheckName = "";
    /**
     * 互检时间
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "MutualCheckTimeS", ParamName2 =
            "MutualCheckTimeE")
    @DBField
    public Calendar MutualCheckTime = Calendar.getInstance();

    /**
     * 检验结果
     */
    @DBCondition
    @DBField
    public int CheckResult = 0;

    /**
     * 不合格原因
     */
    @DBField
    public String BadReason = "";

    /**
     * 自检单ID
     */
    @DBCondition
    @DBField
    public int SelfTaskIPTID = 0;
    /**
     * 互检单ID
     */
    @DBCondition
    @DBField
    public int MutualTaskIPTID = 0;
    /**
     * 专检单ID
     */
    @DBCondition
    @DBField
    public int SpecialTaskIPTID = 0;

    /**
     * 报工单ID
     */
    @DBCondition
    @DBField
    public int TaskReportID = 0;

    public SFCWorkpieceResume() {
        super();
    }

    public SFCWorkpieceResume(int workpieceRecordID, int stationID, int routePartPointID, Calendar onLineTime,
                              int onLinerID, int checkResult) {
        WorkpieceRecordID = workpieceRecordID;
        StationID = stationID;
        RoutePartPointID = routePartPointID;
        OnLineTime = onLineTime;
        OnLinerID = onLinerID;
        CheckResult = checkResult;

        Calendar wBaseTime = Calendar.getInstance();
        wBaseTime.set(2000, 0, 1, 0, 0, 0);

        SelfCheckTime = wBaseTime;
        MutualCheckTime = wBaseTime;
        SpecialCheckTime = wBaseTime;
        ReporterTime = wBaseTime;
    }

    @JsonProperty("WorkpieceRecordID")
    public int getWorkpieceRecordID() {
        return WorkpieceRecordID;
    }

    public void setWorkpieceRecordID(int workpieceRecordID) {
        WorkpieceRecordID = workpieceRecordID;
    }

    @JsonProperty("WorkpieceCode")
    public String getWorkpieceCode() {
        return WorkpieceCode;
    }

    public void setWorkpieceCode(String workpieceCode) {
        WorkpieceCode = workpieceCode;
    }

    @JsonProperty("StationID")
    public int getStationID() {
        return StationID;
    }

    public void setStationID(int stationID) {
        StationID = stationID;
    }

    @JsonProperty("StationName")
    public String getStationName() {
        return StationName;
    }

    public void setStationName(String stationName) {
        StationName = stationName;
    }

    @JsonProperty("StationCode")
    public String getStationCode() {
        return StationCode;
    }

    public void setStationCode(String stationCode) {
        StationCode = stationCode;
    }

    @JsonProperty("RoutePartPointID")
    public int getRoutePartPointID() {
        return RoutePartPointID;
    }

    public void setRoutePartPointID(int routePartPointID) {
        RoutePartPointID = routePartPointID;
    }

    @JsonProperty("RoutePartPointName")
    public String getRoutePartPointName() {
        return RoutePartPointName;
    }

    public void setRoutePartPointName(String routePartPointName) {
        RoutePartPointName = routePartPointName;
    }

    @JsonProperty("RoutePartPointCode")
    public String getRoutePartPointCode() {
        return RoutePartPointCode;
    }

    public void setRoutePartPointCode(String routePartPointCode) {
        RoutePartPointCode = routePartPointCode;
    }

    @JsonProperty("OnLineTime")
    public Calendar getOnLineTime() {
        return OnLineTime;
    }

    public void setOnLineTime(Calendar onLineTime) {
        OnLineTime = onLineTime;
    }

    @JsonProperty("OnLinerID")
    public int getOnLinerID() {
        return OnLinerID;
    }

    public void setOnLinerID(int onLinerID) {
        OnLinerID = onLinerID;
    }

    @JsonProperty("OnLinerName")
    public String getOnLinerName() {
        return OnLinerName;
    }

    public void setOnLinerName(String onLinerName) {
        OnLinerName = onLinerName;
    }

    @JsonProperty("SelfCheckID")
    public int getSelfCheckID() {
        return SelfCheckID;
    }

    public void setSelfCheckID(int selfCheckID) {
        SelfCheckID = selfCheckID;
    }

    @JsonProperty("SelfCheckName")
    public String getSelfCheckName() {
        return SelfCheckName;
    }

    public void setSelfCheckName(String selfCheckName) {
        SelfCheckName = selfCheckName;
    }

    @JsonProperty("SelfCheckTime")
    public Calendar getSelfCheckTime() {
        return SelfCheckTime;
    }

    public void setSelfCheckTime(Calendar selfCheckTime) {
        SelfCheckTime = selfCheckTime;
    }

    @JsonProperty("ReporterID")
    public int getReporterID() {
        return ReporterID;
    }

    public void setReporterID(int reporterID) {
        ReporterID = reporterID;
    }

    @JsonProperty("ReporterName")
    public String getReporterName() {
        return ReporterName;
    }

    public void setReporterName(String reporterName) {
        ReporterName = reporterName;
    }

    @JsonProperty("ReporterTime")
    public Calendar getReporterTime() {
        return ReporterTime;
    }

    public void setReporterTime(Calendar reporterTime) {
        ReporterTime = reporterTime;
    }

    @JsonProperty("SpecialCheckID")
    public int getSpecialCheckID() {
        return SpecialCheckID;
    }

    public void setSpecialCheckID(int specialCheckID) {
        SpecialCheckID = specialCheckID;
    }

    @JsonProperty("SpecialCheckName")
    public String getSpecialCheckName() {
        return SpecialCheckName;
    }

    public void setSpecialCheckName(String specialCheckName) {
        SpecialCheckName = specialCheckName;
    }

    @JsonProperty("SpecialCheckTime")
    public Calendar getSpecialCheckTime() {
        return SpecialCheckTime;
    }

    public void setSpecialCheckTime(Calendar specialCheckTime) {
        SpecialCheckTime = specialCheckTime;
    }

    @JsonProperty("MutualCheckID")
    public int getMutualCheckID() {
        return MutualCheckID;
    }

    public void setMutualCheckID(int mutualCheckID) {
        MutualCheckID = mutualCheckID;
    }

    @JsonProperty("MutualCheckName")
    public String getMutualCheckName() {
        return MutualCheckName;
    }

    public void setMutualCheckName(String mutualCheckName) {
        MutualCheckName = mutualCheckName;
    }

    @JsonProperty("MutualCheckTime")
    public Calendar getMutualCheckTime() {
        return MutualCheckTime;
    }

    public void setMutualCheckTime(Calendar mutualCheckTime) {
        MutualCheckTime = mutualCheckTime;
    }

    @JsonProperty("CheckResult")
    public int getCheckResult() {
        return CheckResult;
    }

    public void setCheckResult(int checkResult) {
        CheckResult = checkResult;
    }

    @JsonProperty("BadReason")
    public String getBadReason() {
        return BadReason;
    }

    public void setBadReason(String badReason) {
        BadReason = badReason;
    }

    @JsonProperty("SelfTaskIPTID")
    public int getSelfTaskIPTID() {
        return SelfTaskIPTID;
    }

    public void setSelfTaskIPTID(int selfTaskIPTID) {
        SelfTaskIPTID = selfTaskIPTID;
    }

    @JsonProperty("MutualTaskIPTID")
    public int getMutualTaskIPTID() {
        return MutualTaskIPTID;
    }

    public void setMutualTaskIPTID(int mutualTaskIPTID) {
        MutualTaskIPTID = mutualTaskIPTID;
    }

    @JsonProperty("SpecialTaskIPTID")
    public int getSpecialTaskIPTID() {
        return SpecialTaskIPTID;
    }

    public void setSpecialTaskIPTID(int specialTaskIPTID) {
        SpecialTaskIPTID = specialTaskIPTID;
    }

    @JsonProperty("TaskReportID")
    public int getTaskReportID() {
        return TaskReportID;
    }

    public void setTaskReportID(int taskReportID) {
        TaskReportID = taskReportID;
    }

    @JsonProperty("IsSpecialCheck")
    public int getIsSpecialCheck() {
        return IsSpecialCheck;
    }

    public void setIsSpecialCheck(int isSpecialCheck) {
        IsSpecialCheck = isSpecialCheck;
    }
}
